home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr11 / ddj9304.zip / WAVELET.ZIP / DECOMP.S < prev    next >
Text File  |  1992-02-04  |  3KB  |  64 lines

  1. #include "dsp_type.h"
  2. #if DSP32
  3. #include "dspregs.h"
  4. #endif
  5.  
  6. .global DECOMP
  7.         /*  DECOMP
  8.             perform recursive decomposition on non-terminating data sequence
  9.             registers used: r1 r2 r3 r4 r5 r6 r11 r12 r13 r14 r15 r16
  10.             accumulators used: a0 a1
  11.  
  12.             input: r1 - pointer to wavelet high-pass filter coefficients
  13.                    r2 - pointer to wavelet low-pass filter coefficients
  14.                    r6 - pointer to wavelet output data list
  15.                    r11 - jump address for proper filter length
  16.                    r12 - pointer to data pointer array
  17.                    r13 - pointer to stack
  18.                    r14 - return stack register, i.e. "TOP OF STACK"
  19.                    r15 - recursion counter
  20.                    r16 - filter coefficient pointer wrap back index
  21.         */
  22. DECOMP:   r3e = *r12++; /* load pointer to approx. input array source */
  23.           r5e = *r12;   /* load pointer to approx. output array destination */
  24.           goto r11;     /* jump to appropriate filter processing for length */
  25.           r4e = r3 + 8; /* set pointer to approx. input array destination */
  26. DT6:      a0 = a0 + *r3++ * *r1++; /* pass data through high-pass wavelet */
  27.           a0 = a0 + *r3++ * *r1++; /* filter (a0 = 0.0 initially) */
  28. DT4:      a0 = a0 + *r3++ * *r1++; /* the destination of the jump depends */
  29.           a0 = a0 + *r3++ * *r1++; /* upon the length of the wavelet */
  30. DT2:      a0 = a0 + *r3++ * *r1++; /* filter */
  31.           goto r11 + 28; /* jump to appropriate filter processing for length */
  32.           *r6++ = a0 = a0 + *r3++r16 * *r1++r16; /* output is detail point */
  33. AT6:      a1 = a1 + (*r4++ = *r3++) * *r2++; /* pass data through low-pass */
  34.           a1 = a1 + (*r4++ = *r3++) * *r2++; /* filter (a1 = 0.0 initially) */
  35. AT4:      a1 = a1 + (*r4++ = *r3++) * *r2++;
  36.           a1 = a1 + (*r4++ = *r3++) * *r2++;
  37. AT2:      a1 = a1 + *r3++ * *r2++;
  38.           a1 = a1 + *r3++ * *r2++r16;
  39.           r15 = r15 - 1;         /* check the recursion count */
  40.           if (eq) goto NO_RECUR; /* if true, recursion at bottom of tree */
  41.           r5e & 0x0004;          /* check for even/odd status */
  42.           *r5-- = a1 = a1;       /* save approx. data for next level */
  43.           if (ne) goto CLEAN_UP; /* if true, await another data point */
  44.           r4e = r5 + 8;          /* wrap output pointer back */
  45.           *r12++ = r4e;          /* save wrapped pointer to approx. O/P */
  46.           *r13-- = r14e;         /* save return address to stack */
  47.           a0 = a0 - a0;          /* clear the accumulators */
  48.           call DECOMP (r14);     /* recurse down the tree */
  49.           a1 = a0;
  50. #if DSP32C
  51.           r13e = r13 + 4;        /* align stack pointer to return address */
  52. #else
  53.           r13 = r13 + 2;         /* align stack pointer to return address */
  54. #endif
  55.           r14e = *r13;           /* pop the return address */
  56.           nop;
  57.           return (r14);
  58.           nop;
  59.  
  60. NO_RECUR: *r6 = a1 = a1;         /* save approx. coeff. as next value */
  61. CLEAN_UP: return (r14);
  62.           *r12++ = r5e;          /* save unwrapped pointer to approx. output */
  63.         /* END OF DECOMP */
  64.